home *** CD-ROM | disk | FTP | other *** search
- package javax.swing;
-
- import java.awt.Component;
- import java.awt.Container;
- import java.awt.Graphics;
- import java.awt.LayoutManager;
- import java.io.IOException;
- import java.io.ObjectOutputStream;
- import javax.accessibility.Accessible;
- import javax.accessibility.AccessibleContext;
- import javax.swing.plaf.SplitPaneUI;
-
- public class JSplitPane extends JComponent implements Accessible {
- private static final String uiClassID = "SplitPaneUI";
- public static final int VERTICAL_SPLIT = 0;
- public static final int HORIZONTAL_SPLIT = 1;
- public static final String LEFT = "left";
- public static final String RIGHT = "right";
- public static final String TOP = "top";
- public static final String BOTTOM = "bottom";
- public static final String DIVIDER = "divider";
- public static final String ORIENTATION_PROPERTY = "orientation";
- public static final String CONTINUOUS_LAYOUT_PROPERTY = "continuousLayout";
- public static final String DIVIDER_SIZE_PROPERTY = "dividerSize";
- public static final String ONE_TOUCH_EXPANDABLE_PROPERTY = "oneTouchExpandable";
- public static final String LAST_DIVIDER_LOCATION_PROPERTY = "lastDividerLocation";
- protected int orientation;
- protected boolean continuousLayout;
- protected Component leftComponent;
- protected Component rightComponent;
- protected int dividerSize;
- protected boolean oneTouchExpandable;
- protected int lastDividerLocation;
-
- public JSplitPane() {
- this(1, false, new JButton("left button"), new JButton("right button"));
- }
-
- public JSplitPane(int var1) {
- this(var1, false);
- }
-
- public JSplitPane(int var1, Component var2, Component var3) {
- this(var1, false, var2, var3);
- }
-
- public JSplitPane(int var1, boolean var2) {
- this(var1, var2, (Component)null, (Component)null);
- }
-
- public JSplitPane(int var1, boolean var2, Component var3, Component var4) {
- ((Container)this).setLayout((LayoutManager)null);
- ((JComponent)this).setOpaque(true);
- this.orientation = var1;
- if (this.orientation != 1 && this.orientation != 0) {
- throw new IllegalArgumentException("cannot create JSplitPane, orientation must be one of JSplitPane.HORIZONTAL_SPLIT or JSplitPane.VERTICAL_SPLIT");
- } else {
- this.continuousLayout = var2;
- if (var3 != null) {
- this.setLeftComponent(var3);
- }
-
- if (var4 != null) {
- this.setRightComponent(var4);
- }
-
- this.updateUI();
- }
- }
-
- protected void addImpl(Component var1, Object var2, int var3) {
- if (var2 != null && !(var2 instanceof String)) {
- throw new IllegalArgumentException("cannot add to layout: constraint must be a string (or null)");
- } else {
- if (var2 == null) {
- if (this.getLeftComponent() == null) {
- var2 = "left";
- } else if (this.getRightComponent() == null) {
- var2 = "right";
- }
- }
-
- if (var2 == null || !var2.equals("left") && !var2.equals("top")) {
- if (var2 != null && (var2.equals("right") || var2.equals("bottom"))) {
- Component var5 = this.getRightComponent();
- if (var5 != null) {
- this.remove(var5);
- }
-
- this.rightComponent = var1;
- var3 = -1;
- } else if (var2 != null && var2.equals("divider")) {
- var3 = -1;
- }
- } else {
- Component var4 = this.getLeftComponent();
- if (var4 != null) {
- this.remove(var4);
- }
-
- this.leftComponent = var1;
- var3 = -1;
- }
-
- super.addImpl(var1, var2, var3);
- ((JComponent)this).revalidate();
- ((Component)this).repaint();
- }
- }
-
- public AccessibleContext getAccessibleContext() {
- if (super.accessibleContext == null) {
- super.accessibleContext = new AccessibleJSplitPane(this);
- }
-
- return super.accessibleContext;
- }
-
- public Component getBottomComponent() {
- return this.rightComponent;
- }
-
- public int getDividerLocation() {
- SplitPaneUI var1 = this.getUI();
- return var1 != null ? var1.getDividerLocation(this) : -1;
- }
-
- public int getDividerSize() {
- return this.dividerSize;
- }
-
- public int getLastDividerLocation() {
- return this.lastDividerLocation;
- }
-
- public Component getLeftComponent() {
- return this.leftComponent;
- }
-
- public int getMaximumDividerLocation() {
- SplitPaneUI var1 = this.getUI();
- return var1 != null ? var1.getMaximumDividerLocation(this) : -1;
- }
-
- public int getMinimumDividerLocation() {
- SplitPaneUI var1 = this.getUI();
- return var1 != null ? var1.getMinimumDividerLocation(this) : -1;
- }
-
- public int getOrientation() {
- return this.orientation;
- }
-
- public Component getRightComponent() {
- return this.rightComponent;
- }
-
- public Component getTopComponent() {
- return this.leftComponent;
- }
-
- public SplitPaneUI getUI() {
- return (SplitPaneUI)super.ui;
- }
-
- public String getUIClassID() {
- return "SplitPaneUI";
- }
-
- public boolean isContinuousLayout() {
- return this.continuousLayout;
- }
-
- public boolean isOneTouchExpandable() {
- return this.oneTouchExpandable;
- }
-
- public boolean isValidateRoot() {
- return true;
- }
-
- protected void paintChildren(Graphics var1) {
- super.paintChildren(var1);
- SplitPaneUI var2 = this.getUI();
- if (var2 != null) {
- Graphics var3 = SwingGraphics.createSwingGraphics(var1);
- var2.finishedPaintingChildren(this, var3);
- var3.dispose();
- }
-
- }
-
- protected String paramString() {
- String var1 = this.orientation == 1 ? "HORIZONTAL_SPLIT" : "VERTICAL_SPLIT";
- String var2 = this.continuousLayout ? "true" : "false";
- String var3 = this.oneTouchExpandable ? "true" : "false";
- return super.paramString() + ",continuousLayout=" + var2 + ",dividerSize=" + this.dividerSize + ",lastDividerLocation=" + this.lastDividerLocation + ",oneTouchExpandable=" + var3 + ",orientation=" + var1;
- }
-
- public void remove(int var1) {
- Component var2 = ((Container)this).getComponent(var1);
- if (var2 == this.leftComponent) {
- this.leftComponent = null;
- } else if (var2 == this.rightComponent) {
- this.rightComponent = null;
- }
-
- super.remove(var1);
- ((JComponent)this).revalidate();
- ((Component)this).repaint();
- }
-
- public void remove(Component var1) {
- if (var1 == this.leftComponent) {
- this.leftComponent = null;
- } else if (var1 == this.rightComponent) {
- this.rightComponent = null;
- }
-
- super.remove(var1);
- ((JComponent)this).revalidate();
- ((Component)this).repaint();
- }
-
- public void removeAll() {
- this.leftComponent = this.rightComponent = null;
- super.removeAll();
- ((JComponent)this).revalidate();
- ((Component)this).repaint();
- }
-
- public void resetToPreferredSizes() {
- SplitPaneUI var1 = this.getUI();
- if (var1 != null) {
- var1.resetToPreferredSizes(this);
- }
-
- }
-
- public void setBottomComponent(Component var1) {
- this.setRightComponent(var1);
- }
-
- public void setContinuousLayout(boolean var1) {
- boolean var2 = this.continuousLayout;
- this.continuousLayout = var1;
- ((JComponent)this).firePropertyChange("continuousLayout", var2, var1);
- }
-
- public void setDividerLocation(double var1) {
- if (!(var1 < (double)0.0F) && !(var1 > (double)1.0F)) {
- if (this.getOrientation() == 0) {
- this.setDividerLocation((int)((double)(((JComponent)this).getHeight() - this.getDividerSize()) * var1));
- } else {
- this.setDividerLocation((int)((double)(((JComponent)this).getWidth() - this.getDividerSize()) * var1));
- }
-
- } else {
- throw new IllegalArgumentException("proportional location must be between 0.0 and 1.0.");
- }
- }
-
- public void setDividerLocation(int var1) {
- SplitPaneUI var2 = this.getUI();
- if (var2 != null) {
- var2.setDividerLocation(this, var1);
- }
-
- }
-
- public void setDividerSize(int var1) {
- int var2 = this.dividerSize;
- if (var2 != var1) {
- this.dividerSize = var1;
- ((JComponent)this).firePropertyChange("dividerSize", var2, var1);
- }
-
- }
-
- public void setLastDividerLocation(int var1) {
- int var2 = this.lastDividerLocation;
- this.lastDividerLocation = var1;
- ((JComponent)this).firePropertyChange("lastDividerLocation", var2, var1);
- }
-
- public void setLeftComponent(Component var1) {
- if (var1 == null) {
- if (this.leftComponent != null) {
- this.remove(this.leftComponent);
- this.leftComponent = null;
- }
- } else {
- ((Container)this).add(var1, "left");
- }
-
- }
-
- public void setOneTouchExpandable(boolean var1) {
- boolean var2 = this.oneTouchExpandable;
- this.oneTouchExpandable = var1;
- ((JComponent)this).firePropertyChange("oneTouchExpandable", var2, var1);
- ((Component)this).repaint();
- }
-
- public void setOrientation(int var1) {
- if (var1 != 0 && var1 != 1) {
- throw new IllegalArgumentException("JSplitPane: orientation must be one of JSplitPane.VERTICAL_SPLIT or JSplitPane.HORIZONTAL_SPLIT");
- } else {
- int var2 = this.orientation;
- this.orientation = var1;
- ((JComponent)this).firePropertyChange("orientation", var2, var1);
- }
- }
-
- public void setRightComponent(Component var1) {
- if (var1 == null) {
- if (this.rightComponent != null) {
- this.remove(this.rightComponent);
- this.rightComponent = null;
- }
- } else {
- ((Container)this).add(var1, "right");
- }
-
- }
-
- public void setTopComponent(Component var1) {
- this.setLeftComponent(var1);
- }
-
- public void setUI(SplitPaneUI var1) {
- if ((SplitPaneUI)super.ui != var1) {
- super.setUI(var1);
- ((JComponent)this).revalidate();
- }
-
- }
-
- public void updateUI() {
- this.setUI((SplitPaneUI)UIManager.getUI(this));
- ((JComponent)this).revalidate();
- }
-
- private void writeObject(ObjectOutputStream var1) throws IOException {
- var1.defaultWriteObject();
- if (super.ui != null && this.getUIClassID().equals("SplitPaneUI")) {
- super.ui.installUI(this);
- }
-
- }
- }
-